package com.simon.app.october.modules.job.task;

import com.simon.app.october.modules.sys.entity.SysUserEntity;
import com.simon.app.october.modules.sys.service.SysUserService;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("testTask")
public class TestTask {
    private org.slf4j.Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private SysUserService userService;

    public void test(String params) {
        logger.info("我是带参数的test方法, 正在被执行，参数为："+params);

        try {
            Thread.sleep(1000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        SysUserEntity userEntity = userService.findById(1L);
        System.out.println(ToStringBuilder.reflectionToString(userEntity));
    }

    public void test2() {
        logger.info("我是不带参数的test2方法,正在被执行！");
    }

    public void test3() {
        try {
            Thread.sleep(10000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
